package com.itbaima.mapper;

import com.itbaima.pojo.VO.SalaryVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SalaryMapper {

    @Select("SELECT name, salary_id, total_salary, allowance, pension_insurance, unemployment_insurance, " +
            "medical_insurance, housing_fund, bonus, dock, hr_salary " +
            "FROM shujuku.hrsalary")
    List<SalaryVO> findAllSalaries();

    /**
     * 更新薪酬信息中的奖励金和扣除金
     * @param salaryId 薪酬标准ID
     * @param bonus 奖励金
     * @param dock 扣除金
     * @return 更新结果
     */
    @Update("UPDATE shujuku.hrsalary " +
            "SET bonus = #{bonus}, dock = #{dock} " +
            "WHERE salary_id = #{salaryId}")
    int updateSalary(@Param("salaryId") Integer salaryId,
                     @Param("bonus") Double bonus,
                     @Param("dock") Double dock);


}

